package com.lz.water.monitor.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.lz.water.monitor.entity.User;
import com.lz.water.monitor.manager.assembler.UserAssembler;
import com.lz.water.monitor.service.UserService;
import com.lz.water.monitor.util.ResponseDataPackageUtils;

@RestController
@RequestMapping("/users/")
public class UserController {

	@Autowired
	UserService userService;

	@RequestMapping(value = "{id}", method = RequestMethod.GET)
	public String get(@PathVariable Integer id) {
		User user = userService.get(id);
		return ResponseDataPackageUtils.success(UserAssembler
				.getUserassembler().toDto(user));
	}
}
